package com.moorror.codegenvel.view.window.codegen.view;

import com.intellij.openapi.project.Project;
import com.intellij.ui.components.JBScrollPane;
import com.moorror.codegenvel.db.sqlite.entity.CodeGenScene;
import com.moorror.codegenvel.utils.JPanelUtils;

import javax.swing.*;
import java.awt.*;

/**
 * @Author jiyanghuang
 * @Date 2025/8/22 21:55
 */
public class TabCodeGenSceneKeyFields extends JPanel{
    private JTextField textFieldRemarks;
    private JPanel rootPanel;

    private CodeGenScene codeGenScene;
    private Project project;

    public TabCodeGenSceneKeyFields(){

    }

    public TabCodeGenSceneKeyFields(Project project, CodeGenScene codeGenScene) {
        this.project = project;
        this.codeGenScene = codeGenScene;
        setLayout(new BorderLayout());
        add(new JBScrollPane(rootPanel), BorderLayout.CENTER);
        fillPanel();
        initEvent();
    }

    public void fetchFromPanel() {
        JPanelUtils.fillTextToObj(textFieldRemarks.getText(), codeGenScene::setDescScene);
    }

    public void fillPanel() {
        JPanelUtils.fillObjToText(codeGenScene::getDescScene, textFieldRemarks);
    }

    private void initEvent() {

    }
}
